package com.qianli.user.enums;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by linchengyu on 17/3/3.
 */
public enum CareerEnum {
    IT_ER(1, "程序员/设计师/产品经理"),
   // STUDENT(2, "学生"),
    TEACHER(3, "教师"),
    WAITER(4, "服务员"),
    DRIVER(5, "司机"),
    COOK(6, "厨师"),
    BARBER(7, "理发师"),
    COACH(8, "教练"),
    CLERK(9, "文员"),
    SALES(10, "销售经理"),
    SERVICEMAN(11, "客服专员"),
    BUYER(12, "采购员"),
    ASSISTANT(13, "营业员"),
    ONLINE_SHOP(14, "网店店长"),
    MAINTENANCE(15, "维修工"),
    COURIER(16, "快递员"),
    LAWYER(17, "律师"),
    TRANSLATOR(18, "翻译"),
    EDITOR(19, "编辑"),
    ACCOUNTANT(20, "会计"),
    DOCTOR(21, "医生"),
    ENGINEER(22, "工程师"),
    OTHER(23, "其他");

    private Integer type;
    private String desc;

    CareerEnum(Integer type, String desc) {
        this.type = type;
        this.desc = desc;
    }

    public Integer getType() {
        return type;
    }

    public CareerEnum setType(Integer type) {
        this.type = type;
        return this;
    }

    public String getDesc() {
        return desc;
    }

    public CareerEnum setDesc(String desc) {
        this.desc = desc;
        return this;
    }

    public static List<String> getDescList() {
        List<String> list = new ArrayList<>();
        for (CareerEnum enumObj : CareerEnum.values()) {
            list.add(enumObj.getDesc());
        }
        return list;
    }

    public static CareerEnum getEnumByType(Integer type) {
        CareerEnum userCareerEnum = null;
        for (CareerEnum enumObj : CareerEnum.values()) {
            if (enumObj.getType().equals(type)) {
                userCareerEnum = enumObj;
                break;
            }
        }
        return userCareerEnum;
    }
    
    public static CareerEnum getEnumByDesc(String desc) {
        CareerEnum userCareerEnum = null;
        for (CareerEnum enumObj : CareerEnum.values()) {
            if (enumObj.getDesc().equals(desc)) {
                userCareerEnum = enumObj;
                break;
            }
        }
        return userCareerEnum;
    }
}
